package com.globallogic.university.events;

import org.testng.Assert;
import org.testng.annotations.Test;
import com.globallogic.university.events.Event.DaysOfWeek;
import com.globallogic.university.people.StudentGroup;
import com.globallogic.university.people.Teacher;
import com.globallogic.university.subject.Subject;
import com.globallogic.university.venues.Auditorium;

public class EventTest {
	
  @Test
  public void shouldSetDayOfWeek() {
	  // given
	  Event event = new Event();
	  
	  // when
	  DaysOfWeek dayOfWeek = DaysOfWeek.WEDNESDAY;
	  event.setDayOfWeek(dayOfWeek);
	  
	  // then
	  Assert.assertEquals(event.getDayOfWeek(), dayOfWeek);
  }
  
  @Test
  public void shouldSetTimeSlotNumber() {
	  // given
	  Event event = new Event();
	  
	  // when
	  Integer timeSlotNumber = 1;
	  event.setTimeSlot(timeSlotNumber);
	  
	  // then
	  Assert.assertEquals(event.getTimeSlot(), timeSlotNumber);
  }
  
  @Test
  public void shouldSetAuditorium() {
	  // given
	  Event event = new Event();
	  
	  // when
	  Auditorium audi = new Auditorium("333");
	  event.setAuditorium(audi);
	  
	  // then
	  Assert.assertEquals(event.getAuditorium(), audi);
  }
  
  @Test
  public void shouldSetLecturer() {
	  // given
	  Event event = new Event();
	  
	  
	  // when
	  Teacher lecturer = new Teacher("John", "Doe");
	  event.setLecturer(lecturer);
	  
	  // then
	  Assert.assertEquals(event.getLecturer(), lecturer);
  }
  
  @Test
  public void shouldSetSubject() {
	  // given
	  String subjectName= "Labour";
	  Subject subject = new Subject(subjectName);
	  
	  Event event = new Event();
	  
	  // when
	  event.setSubject(subject);
	  
	  // then
	  Assert.assertEquals(event.getSubject().getSubjectName(), subjectName);
  }
  
  @Test
  public void shouldSetGroup() {
	  // given
	  String groupId = "Group1";
	  StudentGroup group = new StudentGroup(groupId);
	  
	  Event event = new Event();
	  
	  // when
	  event.setGroup(group);
	  
	  // then
	  Assert.assertEquals(event.getGroup().getGroupId(), groupId);
  }
  
  @Test(expectedExceptions = RuntimeException.class)
  public void shouldNotSetTimeSlotNumberOutOfBound() {
	  // given
	  Event event = new Event();
	  
	  // when
	  Integer timeSlotNumber = 7;
	  event.setTimeSlot(timeSlotNumber);
	  
	  // then
	  // expected exception thrown
  }
}
